package com.ah.shanxi_demo.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 工单类型 枚举
 * @author zt 2020/8/24
 */
public enum OrderTypeEnum implements PolicyCommonInterface {

    //工单状态
    ORDER_TYPE_1("1", "故障"),
    ORDER_TYPE_2("2", "安全事故"),
    ORDER_TYPE_3("3", "预警处置"),
    ORDER_TYPE_4("4", "安全整改"),
    ORDER_TYPE_5("5", "安全扫描"),
    ORDER_TYPE_6("6", "定级备案"),
    ORDER_TYPE_7("7", "等保测评"),
    ORDER_TYPE_8("8", "符合性检测"),
    ORDER_TYPE_9("9", "安全资讯"),
    ORDER_TYPE_10("10", "情报共享"),

     ;

    private String key;
    private String value;

    final static Map<String, OrderTypeEnum> cacheOrderType = new HashMap<>(values().length);

    static {
        for (OrderTypeEnum orderTypeEnum : values()) {
            cacheOrderType.put(orderTypeEnum.key, orderTypeEnum);
        }
    }


    OrderTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static OrderTypeEnum convert(String key) {
        OrderTypeEnum type = cacheOrderType.get(key);
        return type;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public Integer getKeyInt() {
        return Integer.parseInt(key);
    }
}
